void npc(Player @player, NPC @npc) {
const int [] skins = {0, 1, 2, 3, 4, 5, 9, 10};
const int [] eyes = {20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023, 20024, 20025, 20026, 20027, 20028};
const int [] hair = {30000, 30010, 30020, 30030, 30040, 30050, 30060, 30070, 30080, 30090, 30100, 30110, 30120, 30130, 30140, 30150, 30160, 30170, 30180, 30190, 30200, 30210, 30220, 30230, 30240, 30250, 30260, 30270, 30280, 30290, 30300, 30310, 30320, 30330, 30340, 30350, 30360, 30370, 30400, 30410, 30420, 30430, 30440, 30450, 30460, 30470, 30480, 30490, 30510, 30520, 30530, 30540, 30550, 30560, 30570, 30580, 30590, 30600, 30610, 30620, 30630, 30640, 30650, 30660, 30670, 30680, 30690, 30700, 30710, 30720, 30730, 30740, 30750, 30760, 30770, 30780, 30790, 30800, 30810, 30820, 30830, 30740, 30880, 30890, 30900, 30910};
int state = npc.getState();
if(state == 0) {
npc.addText("Hey there! How would you like to change your looks today?\r\n #b#L0#Hair Color#l\r\n#L1#Eyes Color#l\r\n#L2#Hair#l\r\n#L3#Eyes#l\r\n#L4#Skin Color#l#k");
npc.sendSimple();
}
else if(state == 1) {
int type = npc.getSelected();
npc.setVariable("type", type);
if(type == 0) {
int cur = player.getHair()/10*10;
int []colors = {cur, cur+1, cur+2, cur+3, cur+4, cur+5, cur+6, cur+7};
npc.sendStyle(colors);
npc.setState(99);
}
else if(type == 1) {
int cur = player.getFace()%100+20000;
int []colors = {cur, cur+100, cur+200, cur+300, cur+400, cur+500, cur+600, cur+700};
npc.sendStyle(colors);
npc.setState(199);
}
else if(type == 2) {
npc.sendStyle(hair);
npc.setState(299);
}
else if(type == 3) {
npc.sendStyle(eyes);
npc.setState(399);
}
else if(type == 4) {
npc.sendStyle(skins);
npc.setState(499);
}
}
else if(state == 100) {
player.setStyle(player.getHair()/10*10 + npc.getSelected());
npc.end();
}
else if(state == 200) {
player.setStyle(20000 + player.getFace()%100 + npc.getSelected()*100);
npc.end();
}
else if(state == 300) {
player.setStyle(hair[npc.getSelected()]);
npc.end();
}
else if(state == 400) {
player.setStyle(eyes[npc.getSelected()]);
npc.end();
}
else if(state == 500) {
player.setStyle(skins[npc.getSelected()]);
npc.end();
}
}